Closed Bug 604631 Opened 15 years ago Closed 15 years ago

nsPrintEngine::SetupToPrintContent() leaks docTitleStr and docURLStr if mIsCreatingPrintPreview & !seqFrame

Categories

(Core :: Printing: Output, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla2.0b8

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, memory-leak)

Attachments

(1 file)

1650 nsPrintEngine::SetupToPrintContent() 1771 PRUnichar * docTitleStr; 1773 GetDisplayTitleAndURL(mPrt->mPrintObject, &docTitleStr, &docURLStr, eDocTitleDefURLDoc); 1797 if (mIsCreatingPrintPreview) { 1798 // Print Preview -- Pass ownership of docTitleStr and docURLStr 1799 // to the pageSequenceFrame, to be displayed in the header 1800 nsIPageSequenceFrame *seqFrame = mPrt->mPrintObject->mPresShell->GetPageSequenceFrame(); 1801 if (seqFrame) { 1802 seqFrame->StartPrint(mPrt->mPrintObject->mPresContext, 1803 mPrt->mPrintSettings, docTitleStr, docURLStr); this should 0 docURLStr and docTitleStr to show that ownership is transfered 1804 } We leak docURLStr and docTitleStr here if !seqFrame. the following should not be in an else block: 1805 } else { 1806 if (docTitleStr) nsMemory::Free(docTitleStr); 1807 if (docURLStr) nsMemory::Free(docURLStr); 1808 } 1812 NS_ENSURE_SUCCESS(rv, rv); 1823 return rv;
Attached patch patchSplinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #483783 - Flags: review?(dholbert)
Comment on attachment 483783 [details] [diff] [review] patch Ah, good catch. Fix looks good.
Attachment #483783 - Flags: review?(dholbert) → review+
Comment on attachment 483783 [details] [diff] [review] patch Requesting approval2.0. Low risk, fixes a potential leak.
Attachment #483783 - Flags: approval2.0?
Component: Printing: Setup → Printing: Output
QA Contact: printing.setup → printing
Attachment #483783 - Flags: approval2.0? → approval2.0+
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b8
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: